#include <stdio.h>

void bubble_qrt(int arr[], int sz) {
    int i = 0;
    //假设数组已经有序
    int flag = 1;
    for (i = 0; i < sz - 1; i++) {
        int j = 0;
        for (j = 0; j < sz - 1 - i; j++) {
            if (arr[j] > arr[j + 1]) {
                flag = 0;
                int temp = arr[j];
                arr[j] = arr[j + 1];
                arr[j + 1] = temp;
            }
        }
        if (1 == flag) {
            break;
        }
    }
}

int main() {
    int arr[10] = {9, 8, 7, 2, 5, 4, 3, 6, 1, 0};
    int sz = sizeof(arr) / sizeof(arr[0]);
    bubble_qrt(arr, sz);
    int i = 0;
    for (i = 0; i < 10; i++) {
        printf("%d ", arr[i]);
    }
    return 0;
}
